BOJ 11726
11726 2×n 타일링
tip
Clicking the heading will take you to the BOJ problem.
Solution
직접 그려서 점화식 유도했다.
n = int(input())
dp = [0] * (n + 2)
dp[1] = 1
dp[2] = 2
for i in range(3, n + 1):
dp[i] = (dp[i - 1] + dp[i - 2]) % 10007
print(dp[n])
Clicking the heading will take you to the BOJ problem.
직접 그려서 점화식 유도했다.
n = int(input())
dp = [0] * (n + 2)
dp[1] = 1
dp[2] = 2
for i in range(3, n + 1):
dp[i] = (dp[i - 1] + dp[i - 2]) % 10007
print(dp[n])